// Copyright (C) 2009, Jackie Ng
// http://code.google.com/p/mgfdo, jumpinjackie@gmail.com
// 
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// 
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
// 
//
// See license.txt for more/additional licensing information

#ifndef MGPROVIDER_H
#define MGPROVIDER_H

#include "Fdo.h"

#ifdef _WIN32
#define MG_API __declspec(dllexport)
#else
#define MG_API
#endif

//FDO refcounting macro shamelessly c/p'd from the SQLite provider
#define MG_IMPLEMENT_REFCOUNTING \
public:                                                                      \
    virtual void                Dispose()           { delete this; }         \
    virtual FdoInt32            AddRef()            { return ++m_refCount; } \
    virtual FdoInt32            Release()                                    \
    {                                                                        \
        if (--m_refCount )                                                   \
            return m_refCount;                                               \
        Dispose();                                                           \
        return 0;                                                            \
    }                                                                        \
    virtual FdoInt32            GetRefCount()       { return m_refCount; }   \
private:                        int m_refCount;

//Provider information
#define PROVIDER_NAME			L"OSGeo.MapGuide.3.4"
#define PROVIDER_DISPLAY_NAME	L"OSGeo FDO Provider for MapGuide Feature Sources"
#define PROVIDER_DESCRIPTION	L"Read-Only access to MapGuide Feature Sources via MapGuide's mapagent interface"
#define PROVIDER_VERSION		L"3.4.0.0"
#define FDO_VERSION				L"3.4.0.0"

//Other macros
#define STR_NULL_OR_EMPTY(s) (!s || wcslen(s) > 0)

#endif